from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select

driver = webdriver.Edge()
driver.get("E:\python爬虫\python-web-crawler-learning\第5章 抓取动态网页数据\下拉框.html")
element = driver.find_element(By.TAG_NAME, 'select')        # 找到下拉列表框元素
select = Select(element)

# 选择下拉框的第2个选项
select.select_by_index(1)       # 根据索引选择
select.select_by_value('saab')      # 根据值选择（<option>元素中value属性的值）
select.select_by_visible_text('Saab')       # 根据文字选择
